package com.hzzy.application;

import java.util.Timer;
import java.util.TimerTask;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;

/**
 * 启动执行任务
 * @author L
 *
 */
@Service
public class StartupListener implements ApplicationListener<ContextRefreshedEvent> {

	public void onApplicationEvent(ContextRefreshedEvent evt) {
		if (evt.getApplicationContext().getParent() == null) {
			startuptimedtask();
		}
	}
	
	/**
	 * 启动定时任务每天晚上12点执行
	 */
	private void startuptimedtask(){
		
	}

//	private void createSitemap() {
//		System.out.println("--->Create sitemap...");
//		
////		Timer timer = new Timer("createSitemap", true);
////		timer.schedule(new TimerTask() {
////			@Override
////			public void run() {
////				System.out.println("--->Create sitemap...");
////
////				System.out.println("--->Success create sitemap...");
////			}
////		},1000);
//	}
}
